﻿using UnityEngine;
using System.Collections;

public class Jump : MonoBehaviour 
{
	Vector2 myPos;
	Vector2 groundCheckPos;
	private bool _canJump;

	public Vector2 jumpVelocity = new Vector2(0,250f);

	
	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () 
	{
		if(Input.GetKeyDown(KeyCode.Space))
		{
			rigidbody2D.AddForce(jumpVelocity);
			print ("funcao vou pular chamada");
		}
	}
	
	void StayOnFloor () 
	{
		Vector3 fwd4 = transform.TransformDirection(Vector3.down);
		
		RaycastHit hit2;
		
		if (Physics.Raycast(transform.position, fwd4, out hit2, 0.5f))
		{
			string floor = hit2.transform.gameObject.tag;
			
			if(floor == "Floor")
			{	
				_canJump = true;
			}	
		}	

		else
		{
			_canJump = false;
		}
	}


}
